using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pumpkin.Utils
{
    /// <summary>
    /// http://csharpindepth.com/Articles/General/Singleton.aspx
    /// </summary>
    public class Singleton<T> where T : class, new()
    {
        public static T Instance
        {
            get
            {
                return Nested.instance;
            }
        }

        private class Nested
        {
            static Nested()
            {

            }

            internal static readonly T instance = new T();
        }
        public static bool IsCreated
        {
            get
            {
                return Nested.instance != null;
            }
        }
    }
}